package cn.tonyandmoney.baidu.consumers

import io.reactivex.functions.Consumer

/**
 * 捕获异常，防止处理错误导致后续事件无法发送
 */
class RxConsumer<T>(private val callback: Consumer<T>) : Consumer<T> {

    override fun accept(t: T) {
        try {
            callback.accept(t)
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }
}